package com.shxc.smarttrade.index.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.shxc.smarttrade.R;
import com.shxc.smarttrade.base.BaseActivity;

import org.xchris.view.annotation.ContentView;
import org.xchris.view.annotation.Event;
import org.xchris.view.annotation.ViewInject;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 首页 - 消息详情
 */
@ContentView(R.layout.activity_index_message_details)
public class IndexMessageDetailsActivity extends BaseActivity {

    @ViewInject(R.id.title_textview)
    TextView title_textview;
    @ViewInject(R.id.left_imageview)
    ImageView left_imageview;
    @ViewInject(R.id.head_textview)
    TextView head_textview;
    @ViewInject(R.id.time_textview)
    TextView time_textview;
    @ViewInject(R.id.content_textview)
    TextView content_textview;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        title_textview.setText("消息详情");
        left_imageview.setVisibility(View.VISIBLE);

        bundle = getIntent().getExtras();
        head_textview.setText(bundle.getString("title"));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:SS");
        time_textview.setText(sdf.format(new Date(bundle.getLong("time"))));
        content_textview.setText(bundle.getString("content"));
    }

    @Event({R.id.left_imageview})
    private void onClick(View view) {
        switch (view.getId()) {
            case R.id.left_imageview:
                finish();
                break;
        }
    }
}
